
package com.hlkj.pay.service.order.impl;
/*
 * Hlpay-Plus aggregate payment system.
 * Copyright (c) 2024-2025 Hlpay Team Copyright has the right of final interpretation.
 */

import com.hlkj.pay.infrastructure.model.order.OrderSettleDO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import com.hlkj.pay.infrastructure.mapper.order.OrderSettleMapper;
import com.hlkj.pay.service.order.ISettleOrderService;

import lombok.RequiredArgsConstructor;

/**
 * @author HlpayTeam
 * @date 2024/12/29 16:55
 */
@Service
@Slf4j
@RequiredArgsConstructor
public class SettleOrderServiceImpl implements ISettleOrderService {

    private final OrderSettleMapper orderSettleMapper;

    @Override
    public OrderSettleDO queryByCashOrderNo(String sn, String cashOrderNo) {
        return orderSettleMapper.selectOne(OrderSettleDO::getCashOrderNo, cashOrderNo, OrderSettleDO::getSn, sn);
    }

    @Override
    public void addAccessAmount(OrderSettleDO orderDO) {
        orderSettleMapper.insert(orderDO);
    }

    @Override
    public OrderSettleDO queryByPayOrderNo(String payOrderNo) {
        return orderSettleMapper.selectOne(OrderSettleDO::getPayOrderNo, payOrderNo);
    }

    @Override
    public int updateAccessAmountOrder(OrderSettleDO updateAccessAmountOrderDO) {
        return orderSettleMapper.updateById(updateAccessAmountOrderDO);
    }
}
